﻿using System;
using System.Collections.Generic;
using System.Text;
using NUnit.Core;
using NUnit.Framework;
using System.Text.RegularExpressions;

namespace SpGetter
{
    public class Program
    {
        private static SpGetter GetSpGetter(){
            return new SpGetter("DEV-DB1", "kidbtest", "sa", "flvmf2007");
        }
        private static string GetSPContentStringTrimSort(string content)
        {
            string[] empty_replaced_char = new string[] { "\r\n", "\t" };
            for (int i = 0; i < empty_replaced_char.Length; i++){
                content = content.Replace(empty_replaced_char[i], string.Empty);
            }

            string[] splitted = content.Split(new char[] { ' ', }, StringSplitOptions.RemoveEmptyEntries);
            string ret = string.Empty;
            for (int i = 0; i < splitted.Length; i++){
                if (splitted[i].Trim() != string.Empty)
                    ret += i != splitted.Length - 1 ? splitted[i].Trim() + " " : splitted[i].Trim();
            }
            return ret;
        }
        public static void Main(string[] args)
        {
            //string ordered_procedure = "ALTER PROCEDURE dbo.SelectIndex @index int AS Select * from Test where idx = @index RETURN";
            //string splited_under_as = Regex.Split(ordered_procedure, "AS")[0];
            //MatchCollection col = Regex.Matches(splited_under_as, "@[a-zA-Z]* [a-zA-Z0-9\\(\\)]*");

            //if (col.Count > 0)
            //{
            //    foreach (Capture c in col[0].Captures)
            //    {
            //        // @index int
            //        string param_name = Regex.Match(c.Value, "@[a-zA-Z]+").Value;
            //        string param_type = Regex.Match(c.Value, " [a-zA-Z]+").Value;
            //    }
            //}

            string tmp = "@index int(20)";
            string tmp2 = Regex.Match(tmp, "\\([0-9]*\\)").Value;
        }
    }
}